<html style="background:none !important">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<?php echo site_url() ?>css/style.css" type="text/css">
<style type="text/css">
body {
	background:none !important;
	font-size:15px !important;
	font-family:'Times New Roman', Times, serif;
}
.fr,
.fr_2 {
	font-family:'Times New Roman', Times, serif;
	font-size:18px !important;
	padding:2px 5px !important;
}
.strong {
	font-weight: bold;
}
</style>
<script type="text/javascript">
document.title = 'Hóa đơn <?php echo $info['ma'] ?>';
</script>
</head>
<body>
<div style="position:relative;">
	<table width="860px">
		<tr>
			<td class="fr" align="center" colspan="3"><h1 style="padding: 2px 0px;">HÓA ĐƠN BÁN HÀNG</h1></td>
		</tr>
		<tr>
		    <td class="fr" valign="top" width="35%" style="border: none;">
		        <h3 style="padding: 2px 0px;">THÔNG TIN HÓA ĐƠN</h3>
		        <h4 style="padding: 2px 0px;">Mã hóa đơn: <b><a href="<?php echo site_url() ?>don-hang/<?php echo $info['ma'] ?>"><?php echo $info['ma'] ?></a></b></h4>
		        <p>Ngày mua hàng: <?php echo strftime('%d/%m/%Y %H:%M', strtotime($info['date_added'])) ?></p>
		        <p>Hình thức thanh toán: <?php echo ($info['phuongthuc_thanhtoan'] ? 'chuyển khoản' : 'tiền mặt') ?></p>
		        <p>Tình trạng: <?php echo $GLOBALS['orders_status'][$info['status']] ?></p>
		    </td>
		    <td class="fr" valign="top" width="65%" style="border: none;">
		        <h3 style="padding: 2px 0px;">ĐỊA CHỈ THANH TOÁN</h3>
		        <h4 style="padding: 2px 0px;"><?php echo $info['ten_nguoimua'] ?></h4>
		        <p><?php echo $info['diachi_nguoimua'] ?></p>
		        <p>Điện thoại: <?php echo $info['dienthoai_nguoimua'] ?> - Email: <?php echo $info['email_nguoimua'] ?></p>
		        <p>Địa chỉ: <?php echo $info['diachi_giaohang'] ?></p>
		        <p>Ghi chú: <?php echo $info['khachhang_ghichu'] ?></p>
		    </td>		    		    
		</tr>
		<tr>
			<td colspan="3">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
		            <tr id="first">
		                <td class="fr" width="2%" align="center">#</td>
		                <td class="fr" width="40%">Sản phẩm</td>
		                <td class="fr" align="10%" width="100px">Mã hàng</td>	
		                <td class="fr" width="5%" align="center">SL</td>
		                <td class="fr" width="10%" border="0" align="right">Đơn Giá</td>
		                <td class="fr" width="20%" border="0" align="right">Thành tiền</td>
		            </tr>
		            <?php
		            if (is_array($carts) && count($carts))
		            {
			            $i = 1;
			            foreach ($carts as $pro)
			            {
		            ?>
		            <tr>
		                <td class="fr" align="center"><?php echo $i++ ?></td>
		                <td class="fr"><?php echo $pro['name'] ?></td>
		                <td class="fr" border="0" align="center"><?php echo $pro['code'] ?></td>
		                <td class="fr" border="0" align="center"><?php echo number_format($pro['soluong']) ?></td>
		                <td class="fr" border="0" align="right"><?php echo number_format($pro['gia']) ?></td>
		                <td class="fr" border="0" align="right"><?php echo number_format($pro['tongcong']) ?>đ</td>
		            </tr>
		            <?php
		            	}
		        	}
		            if ($info['vat'] || $info['giam_coupon'] || $info['phi_giaohang'])
		            {
		            	echo '<tr>';
		            	echo '<td class="fr" colspan="5" border="0" align="right">Tổng cộng</td>';
		            	echo '<td class="fr" border="0" align="right">'.number_format($info['tongcong']).'đ</td>';
		            	echo '</tr>';
		            }
		            if ($info['vat'])
		            {
		            	echo '<tr>';
		            	echo '<td class="fr" colspan="5" border="0" align="right">VAT 10%</td>';
		            	echo '<td class="fr" border="0" align="right">'.number_format($info['vat']).'đ</td>';
		            	echo '</tr>';
		            }
		            if ($info['giam_coupon'])
		            {
		            	echo '<tr>';
		            	echo '<td class="fr" colspan="5" border="0" align="right">Giảm Coupon</td>';
		            	echo '<td class="fr" border="0" align="right">'.number_format($info['giam_coupon']).'đ</td>';
		            	echo '</tr>';
		            }
		            if ($info['phi_giaohang'])
		            {
		            	echo '<tr>';
		            	echo '<td class="fr" colspan="5" border="0" align="right">Phí giao hàng</td>';
		            	echo '<td class="fr" border="0" align="right">'.number_format($info['phi_giaohang']).'đ</td>';
		            	echo '</tr>';
		            }
		            ?>
		            <tr>
		            	<td class="fr" colspan="5" border="0" align="right">Thanh toán</td>
		            	<td class="fr" border="0" align="right"><b><?php echo number_format($info['tien_thanhtoan']) ?>đ</b></td>
		            </tr>
		            <tr>
		            	<td class="fr" colspan="6" border="0" align="right"><em>Bằng chữ: <?php echo doiso($info['tien_thanhtoan']) ?> đồng</em></td>
		            </tr>
		        </table>
			</td>
		</tr>
		<?php
		if (!empty($info['linkxacthuc']))
		{
		?>
		<tr>
			<td class="fr" align="center" colspan="3">
				<p>XÁC NHẬN ĐƠN HÀNG</p>
				<h2 style="padding: 2px 0px;">MÃ: <a href="<?php echo site_url() ?>don-hang/<?php echo $info['ma'] ?>?code=<?php echo $info['maxacthuc'] ?>"><?php echo $info['maxacthuc'] ?></a></h2>
			</td>
		</tr>
		<?php
		}
		?>
	</table>
</div>
</body>
</html>